#include "BackgroundLayer.h"

BackgroundLayer::BackgroundLayer()
{
}

BackgroundLayer::~BackgroundLayer()
{

}

void BackgroundLayer::initBackground(GamePlayScreen *_parent)
{
    parentScreen = _parent;

    CCSprite *farBackground = new CCSprite();
    farBackground->initWithSpriteFrameName("farbackground.png");
    CCSprite *midBackground = new CCSprite();
    midBackground->initWithSpriteFrameName("midbackground.png");
    CCSprite *nearBackground = new CCSprite();
    nearBackground->initWithSpriteFrameName("nearbackground.png");

    //this->addChild(farBackground, 1, CCPointMake(0.15f, 0.001f), CCPointMake(farBackground->getContentSize().width/2.f, farBackground->getContentSize().height/2.f));
    this->addChild(farBackground, 1,
                   CCPointMake(farBackground->getContentSize().width / parentScreen->worldSize.width / 4.f,
                               farBackground->getContentSize().height / parentScreen->worldSize.height / 4.f),
                   CCPointMake(farBackground->getContentSize().width/2.f, farBackground->getContentSize().height/2.f));
    farBackground->release();

    //this->addChild(midBackground, 2, CCPointMake(0.1f, 0.1f), CCPointMake(midBackground->getContentSize().width/2.f, midBackground->getContentSize().height/2.f));
    this->addChild(midBackground, 2,
                   CCPointMake(midBackground->getContentSize().width / parentScreen->worldSize.width / 4.f,
                               midBackground->getContentSize().height / parentScreen->worldSize.height / 4.f),
                   CCPointMake(midBackground->getContentSize().width/2.f, midBackground->getContentSize().height/2.f));
    midBackground->release();

    //this->addChild(nearBackground, 3, CCPointMake(1.f, 1.f), CCPointMake(nearBackground->getContentSize().width/2.f, nearBackground->getContentSize().height/2.f));
    this->addChild(nearBackground, 3,
                   CCPointMake(nearBackground->getContentSize().width / parentScreen->worldSize.width / 4.f,
                               nearBackground->getContentSize().width / parentScreen->worldSize.width / 4.f),
                   CCPointMake(nearBackground->getContentSize().width/2.f, nearBackground->getContentSize().height/2.f));
    nearBackground->release();
}
